public class arraydemo {
    public static void main(String[] args) {
        int[] ages = new int[]{12, 24, 36};
        //简化写法
        int[] a = {1,2,3,4,5};//也可以和c一样.
        int[] b = {2,3,4,5,6,7};
        System.out.println(b[2]);
        System.out.println(b.length);//引用长度
        //遍历数组.
        int i;
        int sum=0;
        for (i = 0;i<b.length;i++)
        {
            sum+=b[i];
        }
        System.out.println(sum);
    }
}
